<template>
    <el-dialog
      :visible.sync="visible"
      title="确认删除"
      width="30%"
      :before-close="handleClose">
      <span>确定要删除该企业吗？</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取消</el-button>
        <el-button type="danger" @click="confirmDelete">确认</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  export default {
    props: {
      visible: {
        type: Boolean,
        required: true
      },
      id: {
        type: Number,
        required: true
      }
    },
    methods: {
      handleClose() {
        this.$emit('update:visible', false); // 关闭对话框
      },
      confirmDelete() {
        this.$emit('confirm-delete', this.id); // 触发删除事件
        this.handleClose(); // 关闭对话框
      }
    }
  };
  </script>
  
  <style scoped>
  .dialog-footer {
    text-align: right;
  }
  </style>